package com.example.demovote;

import com.example.demovote.controller.LoginInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@SpringBootApplication
@MapperScan("com.example.demovote.mapper")
public class DemoVoteApplication implements WebMvcConfigurer {

    public static void main(String[] args) {
        SpringApplication.run(DemoVoteApplication.class, args);
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor())
                .addPathPatterns("/add.html","/vote.html");
    }
}
